package com.liull.spring_anno;

import com.liull.spring_anno.aop.Calculator;
import com.liull.spring_anno.bean.ApplicationContextUtil;
import com.liull.spring_anno.bean.Person;
import com.liull.spring_anno.config.MainConfigOfAOP;
import com.liull.spring_anno.config.MainConfigOfLifeCycle;
import com.liull.spring_anno.config.PersonConfig;
import lombok.SneakyThrows;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Author: liull
 * @Description:
 * @Date: Created in 23:08 2020/4/8
 * @Modified By:
 */
public class ApplicationBasedOnAnnotation {
    @SneakyThrows public static void main(String[] args) {
        //        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext("com.liull");
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfAOP.class);
        //        Person person = (Person) applicationContext.getBean("person1");
        //        System.out.println(person);
        ApplicationContext applicationContext1 = ApplicationContextUtil.getApplicationContext();
        Calculator calculator = applicationContext1.getBean(Calculator.class);
        calculator.div(10, 1);
    }
}
